<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isErrorPage="true" %>
<html>
<head>
    <title>错误 - 社交平台</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
</head>
<body>
<jsp:include page="/views/header.jsp"/>

<div class="container mt-5">
    <div class="row justify-content-center">
        <div class="col-md-8 text-center">
            <div class="card border-danger">
                <div class="card-header bg-danger text-white">
                    <h4>发生错误</h4>
                </div>
                <div class="card-body">
                    <h1 class="text-danger mb-4">
                        <c:choose>
                            <c:when test="${not empty requestScope['javax.servlet.error.status_code']}">
                                HTTP ${requestScope['javax.servlet.error.status_code']} 错误
                            </c:when>
                            <c:otherwise>
                                服务器错误
                            </c:otherwise>
                        </c:choose>
                    </h1>
                    <p class="lead">抱歉，处理您的请求时发生了错误。</p>

                    <c:if test="${not empty requestScope['javax.servlet.error.message']}">
                        <div class="alert alert-warning">
                                ${requestScope['javax.servlet.error.message']}
                        </div>
                    </c:if>

                    <c:if test="${exception != null}">
                        <details class="mt-3">
                            <summary>错误详情</summary>
                            <pre class="text-start p-3 bg-light rounded"><c:out value="${exception.stackTrace}"/></pre>
                        </details>
                    </c:if>

                    <a href="${pageContext.request.contextPath}/home" class="btn btn-primary mt-4">返回首页</a>
                </div>
            </div>
        </div>
    </div>
</div>

<jsp:include page="/views/footer.jsp"/>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>